const webpack = require('webpack')
module.exports = {
  // outputDir: process.env.NODE_ENV === 'development' ? 'dist' : 'dist',
  outputDir: '../src/main/resources/templates',
  indexPath: 'index.html',
  publicPath: process.env.NODE_ENV === 'development' ? `/${require('./package.json').name}/` : `/${require('./package.json').name}/`,
  assetsDir: process.env.NODE_ENV === 'development' ? 'static' : 'static',
  lintOnSave: true,
  devServer: {
    // 解决内网穿透
    disableHostCheck: true,
    overlay: {
      warnings: true,
      errors: true
    },
    open: true,
    // host: "localhost",
    port: '8080',
    https: false,
    hotOnly: false,
    proxy: { // 代理配置
      '/v1': {
        target: 'http://192.168.1.68:8848',
        pathRewrite: {
          '^/v1': '/'
        },
        changeOrigin: true
      },
      '/v2': {
        target: 'http://192.168.1.68:1235',
        pathRewrite: {
          '^/v2': '/'
        },
        changeOrigin: true
      }
    }
  },
  transpileDependencies: [
    'vuetify'
  ],
  chainWebpack: config => {
    config.plugin('html')
      .tap(args => {
        args[0].title = 'Loading'
        return args
      })
  },
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        'windows.jQuery': 'jquery'
      })
    ]
  },
  css: {
    // 是否使用css分离插件 ExtractTextPlugin
    // extract: true,
    // 开启 CSS source maps?
    // sourceMap: true
    // 启用 CSS modules for all css / pre-processor files.
    // modules: false
  }
}
